function isRightClick(event) {
	var rightclick;
	if (!event) var event = window.event;
	if (event.which) rightclick = (event.which == 3);
	else if (event.button) rightclick = (event.button == 2);
	return rightclick;
};

function isNotEmpty(value) {
	return value != null && $.trim(value).length;
};

function el(div) {
	return $('#' + div);
};

function areSame(object1, object2) {
	return (object1 == null && object2 == null)
		|| (object1 != null && object2 != null && object1["id"] === object2["id"]);
};

function formatDate(date) {
	return moment(date).format("DD.MM.YYYY");
};

function formatSum(sum) {
	return new Number(sum).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
};

function getNumber(map, currency) {
	if(currency in map) {
		return map[currency];
	}
	return 0;
};

function strToInt(value, defaultValue) {
	return value != null? parseInt(value): defaultValue;
}

function random4() {
	return Math.floor((1 + Math.random()) * 0x10000)
		.toString(16)
		.substring(1);
}

function guid() {
	return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
		s4() + '-' + s4() + s4() + s4();
};

function unUndefy(value, defaultValue) {
	if(value === undefined) {
		return defaultValue;
	} else {
		return value;
	}
};

function copyConfig(defaultCfg, srcCfg) {
	var cfg = defaultCfg;
	for(var property in srcCfg) {
		cfg[property] = srcCfg[property];
	}
	return cfg;
};